<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
use App\Models\office;

//医生表
class med_doctor extends Model
{
    use HasFactory;
    protected $table='med_doctor';
    protected $primaryKey='id';
    protected $fillable=['id','docker_name','doctor_image',
        'courtyard_id',//医院
        'position_id',//职称
        'office_id',//科室id
        'hobbydata_id',//标签id???
        'registration_fee',//挂号费
        'doctor_brief',//医生简介
        'doctor_state',//医生状态,
        'weight',//权重
        'created_at', 'updated_at','deleted_at'
        ];
    //数据展示
    public function show()
    {
//        DB::table('')->paginate()
//        return $this->get();
        return $this->paginate(10);
    }

    public function office()
    {
        return $this->hasOne(office::class,'id','office_id')->select('id','name');
    }

}
